
#include "TaylorSeries.h"
#include<stdlib.h>


int main(int argc , char *argv[]){

     
TaylorSeries y(0,1);

double yOne;  

double h;
int i;

  y.setInitialY0(1);
  
//y.setY(0.0);
//y.setT(1.0); 

cout<<"Enter Value for h ==>";

cin>>h; 
//h=0.125;
y.setH(h);
cout<<" Initial y0 = "<<y.getInitialY0()<<endl;

for(i = 0; y.getT() <=  3; ++i){

    
//Taylor Series to compute the value of y1 
 yOne = y.getInitialY0() + (y.getD1() * y.getH())  +  (( y.getD2() * y.getH() * y.getH())/2) ;
       //  +
      //( (y.getD3() * y.getH() * y.getH() * y.getH() )/6 ) + ( (y.getD4() * y.getH() * y.getH() * y.getH() * y.getH())/ 24 );
	      

cout<<"  t =  "<<y.getT();
cout<<"  y =    "<<y.getY()<<endl;
          
//cout<<"yOne = "<<yOne<<endl<<endl;      


     y.setT( y.getT() + h );  
     y.setY( yOne );
     y.setInitialY0( yOne );
     //y.setH( h );
}
 

cout << "\n\n Number of steps to compute is n = "<<i;
return 0;
}






